package cn.yza.并发.CountDownLatch;

import java.util.concurrent.CountDownLatch;

/**
 * @author Honglixi
 * @create 2021-10-08 23:03
 */
public class CountDownLatchDemo {
    public static void main(String[] args) throws Exception {
        //计数器
        CountDownLatch countDownLatch = new CountDownLatch(6);
        for (int i = 1; i <= 6; i++) {
            new Thread(() -> {
                System.out.println(Thread.currentThread().getName() + "\t 国，被灭");
                countDownLatch.countDown();
            },CountryEnum.forEach_CountryEnum(i).getUsername()).start();
        }
        countDownLatch.await();
        System.out.println(Thread.currentThread().getName() + "\t 秦国一统天下");

    }
}
